<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
	<xsl:variable name="cssPath" select="simorg/paths/css" />
	<xsl:variable name="imagePath" select="simorg/paths/images" />
	<xsl:variable name="rootUrl" select="simorg/paths/rootUrl" />
	
	<xsl:template match="/">
		<html xmlns:html="http://www.w3.org/TR/xhtml1/strict" lang="en-US" >
			<head>
				<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
				<link type="text/css" href="{$cssPath}/custom-theme/jquery-ui-1.8.9.custom.css" rel="Stylesheet"/>
				<link type="text/css" href="{$cssPath}main.css" rel="Stylesheet"/>
				<script type="text/javascript" src="http://localhost:8091/simorg/js/jquery-1.4.4.min.js"/>
				<script type="text/javascript" src="http://localhost:8091/simorg/js/jquery-ui-1.8.9.custom.min.js"></script>
				
				<script type="text/javascript">
					$(document).ready(function(){
  						$(".button").button();
  						
  						$('.striped tr:even').addClass('alt');
  						
  						
  						$(".courseRemoveLink").click(function(e) {
    						e.preventDefault();
    						var targetUrl = $(this).attr("href");
							$("#dialog-confirm").dialog({
	     						 buttons : {
							        "Delete course" : function() {
							          window.location.href = targetUrl;
							        },
							        Cancel : function() {
							          $(this).dialog("close");
							        }
							      }
						    });
							$("#dialog-confirm").dialog("open");
   						});
   						$(".courseRemoveLink").button({
            				icons: {
                				primary: "ui-icon-circle-close"
            				},
           					 text: false});
   
 
            
  						$( "#dialog-confirm" ).dialog({
  							autoOpen: false,
							resizable: false,
							height:240,
							width:450,
							modal: true
						});
						
  					});
				</script>
				
				
				<title>SimOrg Administration</title>
             </head>
             <body>
             	<div class="ui-widget top_toolbar" style="font-size:smaller"><span style="float:left" >Simorg Administration Dashboard</span><a class="logoutLink" href="{$rootUrl}admin/logout">logout</a></div>
             	<div id="primaryformdiv" class="ui-widget ui-widget-content ui-corner-all">
             		<h3 style="margin:0px;padding:.5em" class="ui-widget-header div-title">Courses / Instructors</h3>
             		<table class="striped" style="margin-top:1em;width:100%">
             			<thead>
             			<tr>
             			<th>&#160;</th>
             			<th>Course</th>
             			<th>Semester</th>
             			<th>Section</th>
             			<th>Instructor</th>
             			</tr>
             			</thead>
             			<tbody>
             			<xsl:for-each select="simorg/courses/course">
             			<tr>
             				<td style="text-align:center"><a class="courseRemoveLink" href="{$rootUrl}course/delete/{@id}">Remove Course</a></td>
             				<td style="text-align:center"><a href="{$rootUrl}course/view/{@id}"><xsl:value-of select="name"/></a></td>
             				<td style="text-align:center"><xsl:value-of select="semester"/></td>
             				<td style="text-align:center"><xsl:value-of select="section"/></td>
             				<td style="text-align:center"><a href="{$rootUrl}user/view/{user/@id}"><xsl:value-of select="user/username"/></a></td>
             			</tr>
             			
             			</xsl:for-each>
             			</tbody>
             		</table>
             		<div class="toolbar">
             			<a class="button toolbar_button" href="{$rootUrl}user/list">View All Users</a>
             			<a class="button toolbar_button" href="{$rootUrl}user/new?role=Instructor">Create Instructor</a>
             			<a class="button toolbar_button" href="{$rootUrl}course/new">Create Course</a>
             		</div>
             	</div>
             	<div id="dialog-confirm" title="Remove Course?">
					<p><span class="ui-icon ui-icon-alert" style="float:left; margin:0 7px 20px 0;"></span>This will remove the course (and its assignments) permanently. Are you sure?</p>
				</div>
				
             </body>
     	</html>
      </xsl:template>
</xsl:stylesheet>